home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tegl6b.zip / INTROPAK.EXE / lha / EXEVENT2.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-04  |  3KB  |  118 lines

  1. {$F+}  { -- far code model is required for any functions that }
  2.        { -- are to be used as Event Handlers }
  3.  
  4. Uses
  5.     dos,
  6.     tgraph,
  7.  
  8.     virtmem,
  9.     teglfont,
  10.     fastgrph,
  11.     TEGLIntr,
  12.     TEGLICON,
  13.     TEGLUnit,
  14.     TEGLMenu,
  15.     TEGLMain,
  16.     SenseMs,
  17.     DebugUnt;
  18.  
  19. VAR
  20.   om1, om2 : OptionMPtr;
  21.  
  22.  
  23. FUNCTION GetMsSense(FS:imagestkptr; Ms: msclickptr) : WORD;
  24.   BEGIN
  25.     SetMouseSense(fs^.x,fs^.y);
  26.     GetMsSense := 1;
  27.   END;
  28.  
  29.  
  30. FUNCTION InfoOption(FS:imagestkptr; Ms: msclickptr) : WORD;
  31.    VAR
  32.       x,y,x1,y1      : word;
  33.       ifs         : ImageStkPtr;
  34.       ax,ay,ax1,ay1  : word;
  35.       option         : word;
  36.    BEGIN
  37.       HideMouse;
  38.  
  39.       x  := 200;
  40.       y  := 120;
  41.       x1 := x+340;
  42.       y1 := y+100;
  43.  
  44.       ax := Ms^.ms.x+FS^.x;
  45.       ay := Ms^.ms.y+FS^.y;
  46.       ax1 := Ms^.ms.x1+FS^.x;
  47.       ay1 := Ms^.ms.y1+FS^.y;
  48.  
  49.       {-- push image creates the frame and saves the background image }
  50.  
  51.       PushImage(x,y,x1,y1);
  52.       IFS := stackptr;  {-- stackptr has the most recent frame }
  53.  
  54.       {-- ziptobox creates a xor box that moves from one location to }
  55.       {-- another and changes size. The msclickptr passed to the event }
  56.       {-- has the coordinates of the mouse click area that has activated }
  57.       {-- this event. }
  58.  
  59.       ZipToBox(ax,ay,ax1,ay1,x,y,x1,y1);
  60.  
  61.       SetColor(White);
  62.       ShadowBox(x,y,x1,y1);
  63.  
  64.       SetColor(Black);
  65.       SetTeglFont(@font14);
  66.       OutTEGLtextxy(x+5,y+5,'TEGL Windows Toolkit II');
  67.       OutTEGLtextxy(x+5,y+5+TEGLCharHeight,
  68.     'Jan. 1, 1990, Program Written by Richard Tom');
  69.  
  70.       {-- next put up an ok button and associated a mouse click with }
  71.       {-- it. No real event is called we just want to detect the mouse }
  72.       {-- click to know when to close the window. }
  73.  
  74.       PutPict(x+280,y+75,@ImageOk,Black);
  75.       DefineMouseClickArea(IFS,280,75,280+35,75+12,TRUE,
  76.     NilUnitProc,MSClick);
  77.       SetMousePosition(x+290,y+85);
  78.       ShowMouse;
  79.  
  80.       {-- wait until mouse action on this frame }
  81.       WHILE CheckforMouseSelect(IFS)=NIL DO;
  82.       {-- then dispose of the frame and zip back to the orginal postion }
  83.       {-- on the screen. }
  84.  
  85.       HideMouse;
  86.       DropStackImage(ifs);
  87.       ZipFromBox(ax,ay,ax1,ay1,ifs^.x,ifs^.y,ifs^.x1,ifs^.y1);
  88.       ShowMouse;
  89.  
  90.       InfoOption := 1;
  91.    END;
  92.  
  93.  
  94.  
  95. BEGIN
  96.  
  97.    EasyTEGL;
  98.  
  99.  
  100.    om1 := CreateOptionMenu(@Font14);
  101.    DefineOptions(om1,' ~O~pen ', true, NilUnitProc);
  102.    DefineOptions(om1,' ~I~nfo...',true, InfoOption);
  103.    DefineOptions(om1,'-',     false,NilUnitProc);
  104.    DefineOptions(om1,' ~Q~uit ', true, Quit);
  105.  
  106.    om2 := CreateOptionMenu(@Font14);
  107.    DefineOptions(om2,' ~M~emory ',true,ShowCoordinates);
  108.    DefineOptions(om2,' ~M~ouse Sensitivity ',true,GetMsSense);
  109.  
  110.    CreateBarMenu(0,0,getmaxx);
  111.    OutBarOption(' ~F~ile ',om1);
  112.    OutBarOption(' ~U~tility ',om2);
  113.  
  114.    { -- control is then passed to the supervisor }
  115.  
  116.    TEGLSupervisor;
  117. END.
  118.